<?php
/**
 * Created by PhpStorm.
 * User: keke
 * Date: 2020/8/14
 * Time: 11:42
 */

namespace App\Model;


class FinanceRoomSupport extends BaseModel
{
    protected $table = 'finance_room_support';
    protected $fields = ['id', 'support_name', 'support_desc', 'type', 'created_at'];

    public function getSupportList($request)
    {
        $limit = $request->input('limit', 10);
        $page = $request->input('page', 1);

        $supportName = trim($request->input('support_name'));
        $query = new self();

        return $query->where('support_name', 'like', "{$supportName}%")->orderBy('id', 'desc')->paginate($limit, $this->fields, 'page', $page);
    }


    public function createRoomSupport($data)
    {
        return curl_request(getKkaudioApiUrl() . '/inner/finance/settle/createFinanceRoomSupport', $data, 'urlencoded', 'POST');
    }

    public function updateRoomSupport($data)
    {
        return curl_request(getKkaudioApiUrl() . '/inner/finance/settle/updateFinanceRoomSupport', $data, 'urlencoded', 'POST');
    }

    public function deleteRoomSupport($data)
    {
        return curl_request(getKkaudioApiUrl() . '/inner/finance/settle/deleteFinanceRoomSupport', $data, 'urlencoded', 'POST');
    }
}
